package com.dingding.gmall.product.web;

import com.dingding.gmall.product.service.SkuInfoService;
import com.dingding.gmall.product.vo.SkuItemVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

@Slf4j
public class ItemController {


    @Autowired
    private SkuInfoService skuInfoService;

    /**
     * 展示当前sku的详情
     * @param skuId
     * @return
     */
    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        log.info("准查询,skuId:{}", skuId);
        SkuItemVO skuItemVO = skuInfoService.getSkuDetail(skuId);
        //model.addAttribute("item",skuItemVO);
        return "item";
    }
}
